import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore('user', () => {
  const isLoggedIn = ref(false)
  const userInfo = ref({
    username: '',
    email: ''
  })

  const login = (username: string, email: string) => {
    isLoggedIn.value = true
    userInfo.value = { username, email }
  }

  const logout = () => {
    isLoggedIn.value = false
    userInfo.value = { username: '', email: '' }
  }

  return {
    isLoggedIn,
    userInfo,
    login,
    logout
  }
})

